package com.bayes.teamshow.dao;
import com.bayes.teamshow.pojo.User;
import com.bayes.teamshow.pojo.UserBackground;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface UserManageRepository extends JpaRepository<UserBackground,String>,PagingAndSortingRepository<UserBackground,String>{
    //查询所有用户
    List<UserBackground> findAll();

    Page<UserBackground> findAll(Pageable pageable);//分页无条件查询


    //根据ID删除用户
    @Modifying
    @Transactional
    @Query("delete  from UserBackground  where id = ?1")
    void deleteById(long uid);


}
